package fr.tvbarthel.games.chasewhisply.ui.fragments;

import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

import fr.tvbarthel.games.chasewhisply.HomeActivity;
import fr.tvbarthel.games.chasewhisply.R;

public class HalloweenHomeFragment extends Fragment implements View.OnClickListener
{

    private static final String TAG = HalloweenHomeFragment.class.getName() ;

    private HomeActivityListenter mListener = null;

    public static final String FRAGMENT_TAG = "GameHomeFragment_TAG";
    /**
     * Default Constructor.
     * <p/>
     * lint [ValidFragment]
     * http://developer.android.com/reference/android/app/Fragment.html#Fragment()
     * Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state.
     */
    public HalloweenHomeFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_halloweenhome, container, false);
        final int[] clickable = new int[]{
                R.id.playhome,

        };
        for (int i : clickable) {
            final View view = v.findViewById(i);
            view.setOnClickListener(this);
        }
        return v;
    }

    @Override
    public void onResume() {
        super.onResume();

    }


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if (activity instanceof HomeActivityListenter)
        {
            mListener = (HomeActivityListenter) activity;
        } else
        {
            throw new ClassCastException(activity.toString()
                    + " must implement GameHomeFragment.Listener");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    @Override
    public void onClick(View view) {
        if (mListener == null)
            return;
        switch (view.getId()) {
            case R.id.playhome:
                mListener.onStartGameRequested();
                break;
            default:
                break;
        }
    }
}
